import * as React from "react";
import PropTypes from "prop-types";
import {Button, Classes, Dialog} from "@blueprintjs/core";

import './index.less';

class Edit extends React.PureComponent {
    constructor(props) {
        super(props);
        this.handleOk = this.handleOk.bind(this);
    }

    componentDidMount() {}

    handleOk() {
        const { deleteId} = this.props;
        this.props.onOk(deleteId);
    }

    render() {
        const {onClose} = this.props;
        return(
            <Dialog icon="info-sign" onClose={onClose} title="删除" {...this.state} isOpen={true}>
                <div className={Classes.DIALOG_BODY}><p>你确定要删除吗?</p></div>
                <div className={Classes.DIALOG_FOOTER}>
                    <div className={Classes.DIALOG_FOOTER_ACTIONS}>
                        <Button onClick={onClose}>取消</Button>
                        <Button onClick={this.handleOk}>确定</Button>
                    </div>
                </div>
            </Dialog>
        )
    }
}

Edit.propTypes = {
    deleteId: PropTypes.string.isRequired,
    onOk:PropTypes.func.isRequired,
    onClose: PropTypes.func.isRequired,
};

export default Edit;